<template>
  <div style="padding: 16px;">
    <div
      style="font-size: 16px;font-weight: 600;color: #1D2129;margin-bottom: 16px;"
    >
      体育组织情况
    </div>
    <div
      style="background: #F3F3F3; width: 100%;height: 35px;line-height: 40px;display: flex;justify-content: space-between;"
    >
      <el-radio-group v-model="activeTab" size="small" @change="datalist">
        <el-radio-button label="1">体育运动学校</el-radio-button>
        <el-radio-button label="2">竞技体校</el-radio-button>
        <el-radio-button label="3">少儿体校</el-radio-button>
        <el-radio-button label="4">单项体校</el-radio-button>
        <el-radio-button label="4">体育中学</el-radio-button>
      </el-radio-group>
    </div>
    <div style="display: flex;">
      <div style="height: 400px;width:100%;display: flex;">
        <div style="display: flex;margin-top: 32px;">
          <img
            src="@/assets/img/Frame@2x.png"
            alt=""
            style="width: 31px;height: 31px;margin-top: 7px;margin-right: 15px;"
          />
          <div>
            <div style="font-size: 24px;color: #0F0F0F;">34,201</div>
            <div>体育传统项目学校</div>
          </div>
        </div>
        <div style="display: flex;margin-top: 32px;">
          <img
            src="@/assets/img/Frame@2x.png"
            alt=""
            style="width: 31px;height: 31px;margin-top: 7px;margin-right: 15px;"
          />
          <div>
            <div style="font-size: 24px;color: #0F0F0F;">34,201</div>
            <div>指导教师数量/人</div>
          </div>
        </div>
        <div style="display: flex;margin-top: 32px;">
          <img
            src="@/assets/img/Frame@2x.png"
            alt=""
            style="width: 31px;height: 31px;margin-top: 7px;margin-right: 15px;"
          />
          <div>
            <div style="font-size: 24px;color: #0F0F0F;">34,201</div>
            <div>年组织活动总次数/次</div>
          </div>
        </div>
      </div>

      <!-- <div
        style="height: 296px;width:50%;display: flex; border-left: 1px solid  rgba(129,129,129,0.15);"
      >
        <div ref="chart" style="height: 300px;width:100%"></div>
      </div> -->
    </div>
  </div>
</template>

<script>
import * as echarts from "echarts";
// import { schoolSport } from "@/api/statistics";
export default {
  data() {
    return {
      date: new Date().getFullYear(),
      activeTab: 1
    };
  },

  mounted() {
    this.datalist();
  },
  methods: {
    async datalist(e) {
      // const res = await schoolSport({
      //   year: this.date,
      //   schoolSportTypeId: e || this.activeTab
      // });
      // const series = res.data.series;
      // const xAxis = res.data.xAxis;
      // 基于准备好的dom，初始化echarts实例
      this.chart = echarts.init(this.$refs.chart);
      // 指定图表的配置项和数据
      const option = {
        tooltip: {
          trigger: "axis",
          axisPointer: {
            type: "cross",
            crossStyle: {
              color: "#41B776"
            }
          }
        },
        color: ["#41B776"],

        xAxis: [
          {
            type: "category",
            data: ["国家队", "省队", "地市级", "县级"],
            axisPointer: {
              type: "shadow"
            }
          }
        ],
        yAxis: [
          {
            type: "value",
            name: "级次数量",
            min: 0,
            max: 500,
            interval: 100,
            axisLabel: {
              formatter: "{value} "
            }
          }
        ],
        series: [
          {
            type: "bar",
            tooltip: {
              valueFormatter: function(value) {
                return value + " ml";
              }
            },
            data: [20, 49, 70, 232]
          }
        ]
      };

      // 使用刚指定的配置项和数据显示图表。
      this.chart.setOption(option);

      // 监听父元素大小变化 刷新图表
      var ro = new ResizeObserver(entries => {
        for (let entry of entries) {
          const cr = entry.contentRect;
          this.chart.resize();
        }
      });

      ro.observe(this.$refs.chart);
    }
  }
};
</script>

<style></style>
